package com.example.criminalintent;

import java.util.ArrayList;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBarActivity;
import android.view.MenuItem;


public class CrimeActivity extends FragmentActivity {
	private ViewPager mViewPager;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_crime);
		//Call get..() to use support library and FragmentActivity class
		android.support.v4.app.FragmentManager fm = getSupportFragmentManager();
				
		android.support.v4.app.Fragment fragment = fm.findFragmentById(R.id.fragmentContainer);

		if(fragment == null) {
			fragment = new CrimeFragment();
			 
			//Create a new fragment transaction, include one add operation add  and then commit it  
			fm.beginTransaction()
			.add(R.id.fragmentContainer,fragment)
			.commit();
		}
	}


	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// Handle action bar item clicks here. The action bar will
		// automatically handle clicks on the Home/Up button, so long
		// as you specify a parent activity in AndroidManifest.xml.
		int id = item.getItemId();
		if (id == R.id.action_settings) {
			return true;
		}
		return super.onOptionsItemSelected(item);
	}
}
